﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using ChineseSchool.BLL;
using ChineseSchool.Models.Hethong;

namespace ChineseSchool.UserControl.ThuNghiem
{
    public partial class TintucNoibat : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack) return;
            lblNews.Text = LoadNewsContent();
        }

        public string LoadNewsContent()
        {
            const string format = "ddd, dd/MM/yyyy h:mm:ss tt";
            var strNews = "";
            var lstNews = (new B_News()).GetTop10News(5);
            if (lstNews != null && lstNews.Count > 0)
            {                
                foreach (var news in lstNews)
                {                
                    strNews += "<section class=\"featured-world-news\">";
                    strNews += "    <div class=\"featured-world-news-img\">";
                    strNews += "        <img  src=\"" + news.imageUrl + "\" title=\"" + news.title + "\" alt=\"" + news.title + "\">";
                    strNews += "    </div>";
                    strNews += "    <div class=\"featured-world-news-post\">";
                    strNews += "        <h5>"+news.title+"</h5>";
                    strNews += "        " + news.summary + "";
                    strNews += "                        <div class=\"like-comment-readmore\">";
                    strNews += "                            <i class=\"fa fa-thumbs-o-up\">08</i>";
                    strNews += "                            <a href=\"#\" class=\"comments\"><i class=\"fa fa-comments-o\"></i>49</a>";
                    strNews += "                            <a class=\"read-more\" href=\"#\">Read More</a>";
                    strNews += "                        </div>";
                    strNews += "    </div>";
                    strNews += "</section>";
                }                
            }
            return strNews;
        }
    }
}